home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / global-one-water.swf / scripts / __Packages / GameObject.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.4 KB  |  61 lines

  1. class GameObject extends MovieClip
  2. {
  3.    var engine;
  4.    var from;
  5.    var n = 0;
  6.    var xdir = 1;
  7.    static var MAX_ITEMS = 10000;
  8.    static var GLOW_FILTER = new flash.filters.GlowFilter(16777215,1,5,5,10,1,false,false);
  9.    function GameObject()
  10.    {
  11.       super();
  12.    }
  13.    function init(e)
  14.    {
  15.       this.engine = e;
  16.       this.from = this.engine.gameItemScaleTarget;
  17.       this.n = this.engine.indQueue.shift();
  18.    }
  19.    function update()
  20.    {
  21.       this.convertScale();
  22.    }
  23.    function getTargetDepth()
  24.    {
  25.       return this._y * GameObject.MAX_ITEMS + this.n;
  26.    }
  27.    function convertScale()
  28.    {
  29.       var _loc5_ = this.from._xscale / 100;
  30.       var _loc4_ = this.from._yscale / 100;
  31.       var _loc7_ = 1;
  32.       var _loc6_ = 1;
  33.       var _loc3_ = this.from;
  34.       while(_loc3_ != _root)
  35.       {
  36.          _loc3_ = _loc3_._parent;
  37.          _loc5_ *= _loc3_._xscale / 100;
  38.          _loc4_ *= _loc3_._yscale / 100;
  39.       }
  40.       _loc3_ = this;
  41.       while(_loc3_ != _root)
  42.       {
  43.          _loc3_ = _loc3_._parent;
  44.          _loc7_ *= _loc3_._xscale / 100;
  45.          _loc6_ *= _loc3_._yscale / 100;
  46.       }
  47.       this._xscale = _loc5_ / _loc7_ * 100 * this.xdir;
  48.       this._yscale = _loc4_ / _loc6_ * 100;
  49.    }
  50.    function die()
  51.    {
  52.       var _loc2_ = 0;
  53.       while(this._parent.getInstanceAtDepth(_loc2_))
  54.       {
  55.          _loc2_ = _loc2_ + 1;
  56.       }
  57.       this.swapDepths(_loc2_);
  58.       this.removeMovieClip();
  59.    }
  60. }
  61.